<?php
namespace App\Libs\Common;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

/**
 *   京东代付
 */
class JdDfController extends Controller
{	
	

    public function _initialize()
    {   
        header("Content-type: text/html; charset=utf-8");
    }



    //京东代付
    public function pay_df()
    {
         vendor("jdPay_dk.pay_df");

         $obj = new \pay_df();

         $param=[

                'out_trade_no'=>'2345658769211',
                'trade_amount'=>'1',
                'payee_bank_fullname'=>'农业银行',
                'payee_account_type'=>'P',
                'payee_bank_code'=>'ABC',
                'payee_account_name'=>'张米克',
                'payee_account_no'=>'6222600210011817312'
            ];

        $res=$obj->defrayPay($param);


        if (is_array($res)) 
        {
            if ( 'FINI' == $res['trade_status']) 
            {//交易成功
                
                print_r($res);

                return;

            }elseif('WPAR' == $res['trade_status'] || 'BUID' == $res['trade_status'] || 'ACSU' == $res['trade_status']){

                //处理中
                print_r($res);

                return;

            }else{

                $errorMsg='支付失败';
            }
        }else{
            $errorMsg=$res;
        }

        echo  $errorMsg;
    }

		
	
}